#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int score[1000] = { 0 };
	int n = 0;
	int i;
	int max = 0;
	int min = 999;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &score[i]);
	for (i = 0; i < n; i++)
	{
		if (score[i] > max)
			max = score[i];
		if (score[i] < min)
			min = score[i];
	}
	printf("%d",max - min);
	return 0;
}